package com.highcom.controller;

import org.springframework.web.bind.annotation.*;

import javax.servlet.http.Cookie;
import java.util.HashMap;
import java.util.Map;


@RestController
public class Handler {

    @GetMapping("/car/{id}/owner/{username}")
    public Map<String,Object> getCar(@PathVariable("id")Integer id,
                                     @PathVariable("username")String username,
                                     @RequestParam("age") Integer age,
                                     @RequestParam("inters") String[] inters,
                                     @PathVariable Map<String,Object> pv,
                                     @RequestParam Map<String,String> params,
                                     @RequestHeader("Accept") String accept
                                     //@CookieValue("JESSIONID") Cookie cookie

                                     ){
        Map<String,Object> map = new HashMap<>();
        map.put("id",id);
        map.put("username",username);
        map.put("age",age);
        map.put("inters",inters);
        map.put("pv",pv);
        map.put("params",params);
        map.put("accept",accept);
        //map.put("cookie",cookie);

        return map;
    }

    @PostMapping("/save")
    public Map postMthod(@RequestBody String content){
        Map<String,Object> map = new HashMap<>();
        map.put("content",content);
        return map;
    }

}
